<template>
  <dt-modal-edit ref='modal' title='撤场信息编辑' :label-width='140' :width='500' @ok='onOk' :loading='loading'>
  </dt-modal-edit>
</template>

<script>
  import Opt from '../opt/InfoOpt.js'
  import contractMgr from '@/biz/buildingManagement/contract.js'
  
  export default {
    data() {
      return {
        info: {},
        loading: false
      }
    },
    methods: {
      show(info) {
        this.info = {
          realityWithdrawalDate: info.realityWithdrawalDate,
          isWithdrawalDeal: info.isWithdrawalDeal == '1' || info.isWithdrawalDeal == '0' ? info.isWithdrawalDeal : '1',
          unSettlementRoomInfo: info.unSettlementRoomInfo,
          attachList: info.attachList,
          isWithdrawalDealExplain: info.isWithdrawalDealExplain
        }
        this.$refs.modal.show(new Opt(this.info))
      },
      hide() {
        this.$refs.modal.hide()
      },
      onOk() {
        this.loading = true
        contractMgr.saveWithdrawal(this.info).then((res) => {
          this.loading = false
          this.$emit('success')
          this.hide()
        }).catch(err => {
          this.loading = false
        })
      }
    }
  }
</script>

<style lang="scss" scoped>
</style>
